<form action="" method="POST">
<label>Email :</label>
<input type="text" name="email"/><br />
<label>Password :</label>
<input type="password" name="password"/><br/>
<input type="submit" value=" Submit "/><br />
</form>

<?php
include("config.php");
session_start();

if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form 
$myemail=addslashes($_POST['email']); 
$mypassword=addslashes($_POST['password']); 

$sql="SELECT * FROM user WHERE user_email ='$myemail' and user_password ='$mypassword'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$loginID=$row['user_ID'];
$active=$row['active'];
$count=mysql_num_rows($result);

// If result matched $myemail and $mypassword, table row must be 1 row
if($count==1)
{
	if($row['is_admin'] == 0){
		$_SESSION['login_user']=$loginID;
		header("location: index2.php");
	}
	else
	{
		$_SESSION['login_user']=$loginID;
		
	}
}

$error="Your Login Name or Password is invalid";
echo $error;

}
?>
